package com.sicau.system.service.impl;

import java.util.List;

import com.sicau.common.annotation.DataScope;
import com.sicau.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.sicau.system.mapper.BLeaveMapper;
import com.sicau.system.domain.BLeave;
import com.sicau.system.service.IBLeaveService;

/**
 * 请假申请Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-03-19
 */
@Service
public class BLeaveServiceImpl implements IBLeaveService 
{
    @Autowired
    private BLeaveMapper bLeaveMapper;

    /**
     * 查询请假申请
     * 
     * @param id 请假申请主键
     * @return 请假申请
     */
    @Override
    public BLeave selectBLeaveById(Long id)
    {
        return bLeaveMapper.selectBLeaveById(id);
    }

    /**
     * 查询请假申请列表
     * 
     * @param bLeave 请假申请
     * @return 请假申请
     */
    @Override
    @DataScope(userAlias = "u")
    public List<BLeave> selectBLeaveList(BLeave bLeave)
    {
        return bLeaveMapper.selectBLeaveList(bLeave);
    }

    /**
     * 新增请假申请
     * 
     * @param bLeave 请假申请
     * @return 结果
     */
    @Override
    public int insertBLeave(BLeave bLeave)
    {
        bLeave.setCreateTime(DateUtils.getNowDate());
        return bLeaveMapper.insertBLeave(bLeave);
    }

    /**
     * 修改请假申请
     * 
     * @param bLeave 请假申请
     * @return 结果
     */
    @Override
    public int updateBLeave(BLeave bLeave)
    {
        bLeave.setUpdateTime(DateUtils.getNowDate());
        return bLeaveMapper.updateBLeave(bLeave);
    }

    /**
     * 批量删除请假申请
     * 
     * @param ids 需要删除的请假申请主键
     * @return 结果
     */
    @Override
    public int deleteBLeaveByIds(Long[] ids)
    {
        return bLeaveMapper.deleteBLeaveByIds(ids);
    }

    /**
     * 删除请假申请信息
     * 
     * @param id 请假申请主键
     * @return 结果
     */
    @Override
    public int deleteBLeaveById(Long id)
    {
        return bLeaveMapper.deleteBLeaveById(id);
    }
}
